<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libBigWig: bwCommon.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libBigWig
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">bwCommon.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a href="bwCommon_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7dff7d19c1f094d5ff6a88553badffe0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#a7dff7d19c1f094d5ff6a88553badffe0">bwSetPos</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp, size_t pos)</td></tr>
<tr class="memdesc:a7dff7d19c1f094d5ff6a88553badffe0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is <code>fsetpos</code>, while for remote files it fills a memory buffer with data starting at the desired position.  <a href="bwCommon_8h.html#a7dff7d19c1f094d5ff6a88553badffe0">More...</a><br /></td></tr>
<tr class="separator:a7dff7d19c1f094d5ff6a88553badffe0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc16c73076856035477e460ea4ea3d17"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#adc16c73076856035477e460ea4ea3d17">bwRead</a> (void *data, size_t sz, size_t nmemb, <a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp)</td></tr>
<tr class="memdesc:adc16c73076856035477e460ea4ea3d17"><td class="mdescLeft">&#160;</td><td class="mdescRight">A local/remote version of <code>fread</code>. Reads data from either local or remote bigWig files.  <a href="bwCommon_8h.html#adc16c73076856035477e460ea4ea3d17">More...</a><br /></td></tr>
<tr class="separator:adc16c73076856035477e460ea4ea3d17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab55fdfee13cf1d6f16440d8c6bc7a4fe"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#ab55fdfee13cf1d6f16440d8c6bc7a4fe">bwTell</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp)</td></tr>
<tr class="memdesc:ab55fdfee13cf1d6f16440d8c6bc7a4fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine what the file position indicator say. This is equivalent to <code>ftell</code> for local or remote files.  <a href="bwCommon_8h.html#ab55fdfee13cf1d6f16440d8c6bc7a4fe">More...</a><br /></td></tr>
<tr class="separator:ab55fdfee13cf1d6f16440d8c6bc7a4fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1efdd9f510597b0a6ab449f33d4d0966"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structbwRTree__t.html">bwRTree_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#a1efdd9f510597b0a6ab449f33d4d0966">bwReadIndex</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp, uint64_t offset)</td></tr>
<tr class="memdesc:a1efdd9f510597b0a6ab449f33d4d0966"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with <code>bwDestroyIndex</code>  <a href="bwCommon_8h.html#a1efdd9f510597b0a6ab449f33d4d0966">More...</a><br /></td></tr>
<tr class="separator:a1efdd9f510597b0a6ab449f33d4d0966"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac783a22d0eba14f369d7122c19b601ca"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#ac783a22d0eba14f369d7122c19b601ca">bwDestroyIndexNode</a> (<a class="el" href="structbwRTreeNode__t.html">bwRTreeNode_t</a> *node)</td></tr>
<tr class="memdesc:ac783a22d0eba14f369d7122c19b601ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy an <a class="el" href="structbwRTreeNode__t.html" title="A node within an R-tree holding the index for data.">bwRTreeNode_t</a> and all of its children.  <a href="bwCommon_8h.html#ac783a22d0eba14f369d7122c19b601ca">More...</a><br /></td></tr>
<tr class="separator:ac783a22d0eba14f369d7122c19b601ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28fafebf80e74cc1802bcc45d415560e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#a28fafebf80e74cc1802bcc45d415560e">bwDestroyIndex</a> (<a class="el" href="structbwRTree__t.html">bwRTree_t</a> *idx)</td></tr>
<tr class="memdesc:a28fafebf80e74cc1802bcc45d415560e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees space allocated by <code>bwReadIndex</code> There is generally little reason to use this, since end users should typically not need to run <code>bwReadIndex</code> themselves.  <a href="bwCommon_8h.html#a28fafebf80e74cc1802bcc45d415560e">More...</a><br /></td></tr>
<tr class="separator:a28fafebf80e74cc1802bcc45d415560e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a704e7ffb4907a0afcd63d8dbc73dea27"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="bwCommon_8h.html#a704e7ffb4907a0afcd63d8dbc73dea27">bwFinalize</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp)</td></tr>
<tr class="memdesc:a704e7ffb4907a0afcd63d8dbc73dea27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end.  <a href="bwCommon_8h.html#a704e7ffb4907a0afcd63d8dbc73dea27">More...</a><br /></td></tr>
<tr class="separator:a704e7ffb4907a0afcd63d8dbc73dea27"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>You have no reason to use these functions. They may change without warning because there's no reason for them to be used outside of libBigWig's internals.</p>
<p>These are structures and functions from a variety of files that are used across files internally but don't need to be see by libBigWig users. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a28fafebf80e74cc1802bcc45d415560e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28fafebf80e74cc1802bcc45d415560e">&#9670;&nbsp;</a></span>bwDestroyIndex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void bwDestroyIndex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbwRTree__t.html">bwRTree_t</a> *&#160;</td>
          <td class="paramname"><em>idx</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Frees space allocated by <code>bwReadIndex</code> There is generally little reason to use this, since end users should typically not need to run <code>bwReadIndex</code> themselves. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">idx</td><td>A <a class="el" href="structbwRTree__t.html">bwRTree_t</a> pointer allocated by <code>bwReadIndex</code>. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac783a22d0eba14f369d7122c19b601ca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac783a22d0eba14f369d7122c19b601ca">&#9670;&nbsp;</a></span>bwDestroyIndexNode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void bwDestroyIndexNode </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbwRTreeNode__t.html">bwRTreeNode_t</a> *&#160;</td>
          <td class="paramname"><em>node</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy an <a class="el" href="structbwRTreeNode__t.html" title="A node within an R-tree holding the index for data.">bwRTreeNode_t</a> and all of its children. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node</td><td>The node to destroy. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a704e7ffb4907a0afcd63d8dbc73dea27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a704e7ffb4907a0afcd63d8dbc73dea27">&#9670;&nbsp;</a></span>bwFinalize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int bwFinalize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Finishes what's needed to write a bigWigFile Flushes the buffer, converts the index linked list to a tree, writes that to disk, handles zoom level stuff, writes magic at the end. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fp</td><td>A valid <a class="el" href="structbigWigFile__t.html" title="A structure that holds everything needed to access a bigWig file.">bigWigFile_t</a> pointer </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>

</div>
</div>
<a id="adc16c73076856035477e460ea4ea3d17"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adc16c73076856035477e460ea4ea3d17">&#9670;&nbsp;</a></span>bwRead()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t bwRead </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>sz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nmemb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>A local/remote version of <code>fread</code>. Reads data from either local or remote bigWig files. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>An allocated memory block big enough to hold the data. </td></tr>
    <tr><td class="paramname">sz</td><td>The size of each member that should be copied. </td></tr>
    <tr><td class="paramname">nmemb</td><td>The number of members to copy. </td></tr>
    <tr><td class="paramname">fp</td><td>The <a class="el" href="structbigWigFile__t.html" title="A structure that holds everything needed to access a bigWig file.">bigWigFile_t</a> * from which to copy the data. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="bwCommon_8h.html#a7dff7d19c1f094d5ff6a88553badffe0" title="Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the ...">bwSetPos</a> </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>For nmemb==1, the size of the copied data. For nmemb&gt;1, the number of members fully copied (this is equivalent to <code>fread</code>). </dd></dl>

</div>
</div>
<a id="a1efdd9f510597b0a6ab449f33d4d0966"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1efdd9f510597b0a6ab449f33d4d0966">&#9670;&nbsp;</a></span>bwReadIndex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structbwRTree__t.html">bwRTree_t</a>* bwReadIndex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads a data index (either full data or a zoom level) from a bigWig file. There is little reason for end users to use this function. This must be freed with <code>bwDestroyIndex</code> </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fp</td><td>A valid <a class="el" href="structbigWigFile__t.html" title="A structure that holds everything needed to access a bigWig file.">bigWigFile_t</a> pointer </td></tr>
    <tr><td class="paramname">offset</td><td>The file offset where the index begins </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structbwRTree__t.html">bwRTree_t</a> pointer or NULL on error. </dd></dl>

</div>
</div>
<a id="a7dff7d19c1f094d5ff6a88553badffe0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7dff7d19c1f094d5ff6a88553badffe0">&#9670;&nbsp;</a></span>bwSetPos()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int bwSetPos </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>pos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Like fsetpos, but for local or remote bigWig files. This will set the file position indicator to the specified point. For local files this literally is <code>fsetpos</code>, while for remote files it fills a memory buffer with data starting at the desired position. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fp</td><td>A valid opened <a class="el" href="structbigWigFile__t.html" title="A structure that holds everything needed to access a bigWig file.">bigWigFile_t</a>. </td></tr>
    <tr><td class="paramname">pos</td><td>The position within the file to seek to. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success and -1 on error. </dd></dl>

</div>
</div>
<a id="ab55fdfee13cf1d6f16440d8c6bc7a4fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab55fdfee13cf1d6f16440d8c6bc7a4fe">&#9670;&nbsp;</a></span>bwTell()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long bwTell </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Determine what the file position indicator say. This is equivalent to <code>ftell</code> for local or remote files. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fp</td><td>The file. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The position in the file. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Nov 8 2020 13:48:36 for libBigWig by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
